HAL1 CRYP –> HAL2 CRYP ¶
This section provides information about the HAL CRYP types migration .
HAL CRYP enumeration migration ¶
HAL CRYP callbacks ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_CRYP_INPUTCPLT_CB_ID,
HAL_CRYP_INPUT_COMPLETE_CB_ID,
HAL_CRYP_OUTPUTCPLT_CB_ID,
HAL_CRYP_OUTPUT_COMPLETE_CB_ID,
HAL_CRYP_COMPCPLT_CB_ID,
HAL_CRYP_ERROR_CB_ID,
HAL_CRYP_MSPINIT_CB_ID,
HAL_CRYP_MSPDEINIT_CB_ID,
} HAL_CRYP_CallbackIDTypeDef;
|
Removed
|
Related concept: Individual callback registration APIs replace global register and unregister functions
HAL CRYP suspend mode type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_CRYP_SUSPEND_NONE,
HAL_CRYP_SUSPEND,
} HAL_SuspendTypeDef;
|
Removed ; In HAL2, all CRYP states are defined in the hal_cryp_state_t enumeration. |
HAL CRYP state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_CRYP_STATE_RESET
HAL_CRYP_STATE_READY
HAL_CRYP_STATE_BUSY
HAL_CRYP_STATE_TIMEOUT
HAL_CRYP_STATE_ERROR
HAL_CRYP_STATE_SUSPENDED
} HAL_CRYP_STATETypeDef;
|
typedef enum
{
HAL_CRYP_STATE_RESET,
HAL_CRYP_STATE_INIT,
HAL_CRYP_STATE_ACTIVE,
HAL_CRYP_STATE_IDLE,
HAL_CRYP_STATE_SUSPENDED,
} hal_cryp_state_t;
|
Related concept: Revised and optimized HAL state machine
HAL CRYP phase type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_CRYP_PHASE_READY
HAL_CRYP_PHASE_PROCESS
HAL_CRYP_PHASE_START
HAL_CRYP_PHASE_INIT_OVER
HAL_CRYP_PHASE_HEADER_OVER
HAL_CRYP_PHASE_PAYLOAD_OVER
HAL_CRYP_PHASE_FINAL_OVER
HAL_CRYP_PHASE_HEADER_SUSPENDED
HAL_CRYP_PHASE_PAYLOAD_SUSPENDED
HAL_CRYP_PHASE_NOT_USED
} HAL_PhaseTypeDef;
|
Removed ; In HAL2, the processing phase structure is an internal structure in the handle that is not needed for the user. |
HAL CRYP structure migration ¶
HAL CRYP handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct __CRYP_HandleTypeDef
{
/* Structure members for HAL1 */
} CRYP_HandleTypeDef;
|
typedef struct hal_cryp_handle_s hal_cryp_handle_t;
struct hal_cryp_handle_s
{
/* Structure members for HAL2 */
};
|
Related concepts:
HAL CRYP initialization type definition ¶
In HAL2, each algorithm has its own function configuration, so we no longer require a global configuration structure.
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t *pInitVect;
uint32_t *Header;
uint32_t HeaderSize;
uint32_t DataType;
uint32_t KeySize;
uint32_t *pKey;
uint32_t *B0;
uint32_t DataWidthUnit;
uint32_t HeaderWidthUnit;
uint32_t KeyIVConfigSkip;
uint32_t Algorithm;
uint32_t KeyMode;
uint32_t KeySelect;
uint32_t KeyProtection;
} CRYP_ConfigTypeDef, CRYP_InitTypeDef;
|
typedef struct
{
uint32_t *p_init_vect;
uint32_t *p_header;
uint32_t header_size_byte ;
} hal_cryp_gcm_config_t;
typedef struct
{
uint32_t *p_b0;
uint32_t *p_header;
uint32_t header_size_byte;
} hal_cryp_ccm_config_t;
New Configuration functions for each algorithm, example HAL_CRYP_AES_ECB_SetConfig().
New set key functions are used to configure the key example HAL_CRYP_AES_SetNormalKey().
|
Related concepts:
HAL CRYP context type definition ¶
The contents of the Context structure are internal to the driver and do not need to be modified by the user.
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t CR_Reg;
uint32_t IVR0_Reg;
uint32_t IVR1_Reg;
uint32_t IVR2_Reg;
uint32_t IVR3_Reg;
uint32_t DataType;
uint32_t KeySize;
uint32_t *pKey;
uint32_t *pInitVect;
uint32_t Algorithm;
uint32_t DataWidthUnit;
uint32_t KeyIVConfigSkip;
uint32_t KeyMode;
uint32_t Phase;
uint32_t KeyIVConfig;
uint32_t IER_Reg;
} CRYP_ContextTypeDef;
|
typedef struct
{
uint32_t CR;
uint32_t iv_buff[4];
uint32_t SUSPxR[8];
hal_cryp_t instance;
volatile hal_cryp_state_t previous_state;
uint32_t algorithm;
volatile uint32_t data_size_byte;
volatile uint32_t data_size_sum_byte;
const uint32_t *p_in_buff;
uint32_t *p_out_buff;
volatile uint32_t block_count;
const uint32_t *p_header;
uint32_t header_size_byte ;
volatile uint32_t suspend_request;
const uint32_t *p_key;
hal_cryp_cb_t p_in_cplt_cb;
hal_cryp_cb_t p_out_cplt_cb;
hal_cryp_cb_t p_error_cb;
hal_cryp_cb_t p_suspend_cb;
} hal_cryp_save_context_t;
|
Related concept: Replaced TypeDef suffix with _t in type names
HAL CRYP callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
pCRYP_CallbackTypeDef |
hal_cryp_cb_t |
Related concept: Replaced TypeDef suffix with _t in type names